
package vip.xiaonuo.biz.modular.lancerCoupon.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.biz.modular.lancerCoupon.entity.BizCoupon;
import vip.xiaonuo.biz.modular.lancerCoupon.param.BizCouponAddParam;
import vip.xiaonuo.biz.modular.lancerCoupon.param.BizCouponEditParam;
import vip.xiaonuo.biz.modular.lancerCoupon.param.BizCouponIdParam;
import vip.xiaonuo.biz.modular.lancerCoupon.param.BizCouponPageParam;
import vip.xiaonuo.biz.modular.lancerCoupon.service.BizCouponService;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.common.pojo.CommonValidList;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;

/**
 * 优惠券表控制器
 *
 * @author Lancer
 * @date  2024/03/03 16:29
 */
@Api(tags = "优惠券(C端)")
@ApiSupport(author = "LANCER_TEAM", order = 1)
@RestController
@Validated
public class ClientCouponController {

    @Resource
    private BizCouponService bizCouponService;


    @ApiOperationSupport(order = 1)
    @ApiOperation("C端获取优惠券表分页")
    @GetMapping("/biz/client/coupon/page")
    public CommonResult<Page<BizCoupon>> page(BizCouponPageParam bizCouponPageParam) {
        return CommonResult.data(bizCouponService.pageClient(bizCouponPageParam));
    }
    @ApiOperationSupport(order = 2)
    @ApiOperation("C端抢占优惠券")
    @GetMapping("/biz/client/coupon/grab/{id}")
    public CommonResult<Page<BizCoupon>> grab(@PathVariable String id) {
        bizCouponService.grab(id);
        return CommonResult.ok();
    }
}
